/*
*编写程序将int型的list容器的所有元素复制到两个deque容器中。
*list容器的元素如果为偶数，则复制到一个deque容器中；如果为奇数，则复制到另一个deque容器里面
*/
#include <iostream>
#include <deque>
#include <list>
using namespace std;


int main()
{
	list<int> ilist;
	ilist.push_back(3);
	ilist.push_back(42);
	ilist.push_back(21);
	ilist.push_back(23);
	ilist.push_back(44);
	ilist.push_back(62);
	ilist.push_back(83);
	ilist.push_back(90);
	ilist.push_back(11);
	ilist.push_back(56);

	//奇数
	deque<int> oDeque;
	//偶数
	deque<int> eDeque;
	for(list<int>::iterator iter = ilist.begin();iter != ilist.end();iter++)
	{
		if(*iter % 2 == 0)
		{
			eDeque.push_back(*iter);
		}
		else
		{
			oDeque.push_back(*iter);
		}
	}

	cout << "oDeque:" << endl;
	for(deque<int>::iterator iter = oDeque.begin();iter != oDeque.end();iter++)
	{
		cout << *iter << "  ";
	}

	cout << endl;
	cout << "eDeque:" << endl;
	for(deque<int>::iterator iter = eDeque.begin();iter != eDeque.end();iter++)
	{
		cout << *iter << "  ";
	}

	cout << endl;
	system("pause");
	return 0;
}
